/**
 *
 */
package com.angel.annotation.builder;

import java.lang.annotation.ElementType;
import java.util.Map;

import com.angel.annotation.interfaces.AnnotationAction;
import com.angel.annotation.managers.AnnotationManager;
import com.angel.annotation.managers.AnnotationManagerLocator;

/**
 * @author William
 *
 */
public class AnnotationManagerBuilder {

	private Map<ElementType, ? extends AnnotationAction> actions;
	private Class<? extends AnnotationManager> annotationManagerClass;

	private AnnotationManager annotationManager;

	public AnnotationManagerBuilder(Class<? extends AnnotationManager> annotationManagerClass) {
		super();
		this.annotationManagerClass = annotationManagerClass;
	}

	public AnnotationManagerBuilder(Class<? extends AnnotationManager> annotationManagerClass, Map<ElementType, ? extends AnnotationAction> actions) {
		this(annotationManagerClass);
		this.actions = actions;
	}

	public void buildAnnotationManager(){
		this.annotationManager = AnnotationManagerLocator.locate(annotationManagerClass, actions);
	}

	public AnnotationManager getAnnotationManagerResult(){
		return this.annotationManager;
	}

	/**
	 * @return the actions
	 */
	public Map<ElementType, ? extends AnnotationAction> getActions() {
		return actions;
	}

	/**
	 * @param actions the actions to set
	 */
	public void setActions(Map<ElementType, ? extends AnnotationAction> actions) {
		this.actions = actions;
	}

	/**
	 * @return the annotationManager
	 */
	public AnnotationManager getAnnotationManager() {
		return annotationManager;
	}

	/**
	 * @param annotationManager the annotationManager to set
	 */
	public void setAnnotationManager(AnnotationManager annotationManager) {
		this.annotationManager = annotationManager;
	}

	/**
	 * @return the annotationManagerClass
	 */
	protected Class<? extends AnnotationManager> getAnnotationManagerClass() {
		return annotationManagerClass;
	}

	/**
	 * @param annotationManagerClass the annotationManagerClass to set
	 */
	protected void setAnnotationManagerClass(
			Class<? extends AnnotationManager> annotationManagerClass) {
		this.annotationManagerClass = annotationManagerClass;
	}
}
